home *** CD-ROM | disk | FTP | other *** search
- package com.sun.java.swing.plaf.basic;
-
- import com.sun.java.swing.AbstractAction;
- import java.awt.Dimension;
- import java.awt.Rectangle;
- import java.awt.event.ActionEvent;
- import java.io.Serializable;
-
- class BasicTreeUI$TreePageAction extends AbstractAction implements Serializable {
- // $FF: synthetic field
- BasicTreeUI this$0;
- private int direction;
-
- // $FF: synthetic method
- public BasicTreeUI$TreePageAction(BasicTreeUI this$0, int direction, String name) {
- super(name);
- this.this$0 = this$0;
- this.direction = direction;
- }
-
- public void actionPerformed(ActionEvent e) {
- if (this.this$0.tree != null && this.this$0.getRowCount() > 0 && this.this$0.treeSelectionModel != null) {
- Dimension maxSize = this.this$0.tree.getSize();
- Rectangle visRect = this.this$0.tree.getVisibleRect();
- int maxVisY = Math.max(0, maxSize.height - visRect.height);
- int selIndex;
- if (this.direction == -1) {
- selIndex = this.this$0.getMinSelectionRow();
- } else {
- selIndex = this.this$0.getMaxSelectionRow();
- }
-
- if (selIndex != -1) {
- Rectangle selRect = this.this$0.getRowBounds(selIndex);
- if (this.direction == -1) {
- visRect.y = Math.max(0, selRect.y + selRect.height - visRect.height);
- } else {
- visRect.y = Math.min(maxVisY, selRect.y);
- }
- } else {
- visRect.y = Math.min(maxVisY, visRect.y + visRect.height * this.direction);
- }
-
- int newIndex;
- if (this.direction == 1) {
- newIndex = this.this$0.getClosestRowForLocation(visRect.x, visRect.y + visRect.height - 1);
- Rectangle var8 = this.this$0.getRowBounds(newIndex);
- visRect.y = Math.min(maxVisY, var8.y + var8.height - visRect.height);
- } else {
- newIndex = this.this$0.getClosestRowForLocation(visRect.x, visRect.y + 1);
- Rectangle var9 = this.this$0.getRowBounds(newIndex);
- visRect.y = Math.min(maxVisY, var9.y);
- }
-
- this.this$0.tree.scrollRectToVisible(visRect);
- this.this$0.tree.setSelectionRow(newIndex);
- }
-
- }
-
- public boolean isEnabled() {
- return this.this$0.tree != null && this.this$0.tree.isEnabled();
- }
- }
-